package cn.tedu.hospital.admin.server.statistics.service.impl;

import cn.tedu.hospital.admin.server.common.pojo.vo.PageData;
import cn.tedu.hospital.admin.server.statistics.dao.persist.repository.IPayDetailRepository;
import cn.tedu.hospital.admin.server.statistics.pojo.vo.PayDetailStatisticsVO;
import cn.tedu.hospital.admin.server.statistics.service.IPayDetailService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

/**
 * 收费明细相关的业务实现类
 *
 * @author java@tedu.cn
 * @version 1.0
 */
@Slf4j
@Service
public class PayDetailServiceImpl implements IPayDetailService {

    @Value("${tea-store.dao.default-query-page-size}")
    private Integer defaultQueryPageSize;
    @Autowired
    private IPayDetailRepository payDetailRepository;

    @Override
    public PageData<PayDetailStatisticsVO> listInPay(Integer page) {
        log.debug("开始处理【收费明细列表查询】的业务， 页码：{}", page);
        Integer pageNum = page == null ? 1 : page;
        PageData<PayDetailStatisticsVO> pageData = payDetailRepository.listInPay(pageNum, defaultQueryPageSize);
        return pageData;
    }

    @Override
    public PageData<PayDetailStatisticsVO> listInPay(Integer page, Integer pageSize) {
        log.debug("开始处理【收费明细列表查询】的业务，页码：{}，每页记录数：{}", page, pageSize);
        Integer pageNum = page == null ? 1 : page;
        PageData<PayDetailStatisticsVO> pageData = payDetailRepository.listInPay(pageNum, pageSize);
        return pageData;
    }

    @Override
    public PayDetailStatisticsVO PayByName(String name) {
        log.debug("开始处理【查询对应收费明细】的业务，病人姓名：{}", name);
        return payDetailRepository.PayByName(name);
    }
}
